// app/model/user.js
module.exports = (app) => {
	const {
		STRING,
		INTEGER,
		BIGINT,
		DATE,
		DECIMAL
	} = app.Sequelize;

	const DtsOrder = app.model.define("order", {
		id: {
			type: INTEGER,
			primaryKey: true,
			autoIncrement: true
		},
		userId: INTEGER,
		orderSn: STRING,
		orderStatus: INTEGER,
		consignee: INTEGER,
		mobile: STRING,
		address: STRING,
		message: STRING,
		goodsPrice: DECIMAL,
		freightPrice: DECIMAL,
		couponPrice: DECIMAL,
		integralPrice: DECIMAL,
		grouponPrice: DECIMAL,
		orderPrice: DECIMAL,
		actualPrice: DECIMAL,
		payId: STRING,
		payTime: DATE,
		shipSn: STRING,
		shipChannel: STRING
	}, {
		tableName: "dts_order",
		paranoid: false,
		timestamps: false,
		freezeTableName: true
	});
	
	
	// 声明关系
	  // DtsOrder.associate = function (){
	  // 	// 一个班有很多学生，所以用hasMany
	  //   DtsOrder.hasMany(app.model.DtsOrderGoods, {as: "goodsObg"});
	  // }
	
	return DtsOrder;
};